﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace Charities.Forms
{
    public partial class frmHelp : Form
    {
        public frmHelp(Form _fo )
        {
            MdiParent = _fo;
            fo = _fo;
            InitializeComponent();
        }
        public bool is_loaded = false;
        Form fo = null;
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            string curDir = Directory.GetCurrentDirectory();
            TreeNode node = treeView1.SelectedNode;
            string urle = String.Format("file:///{0}/Documentations/{1}.mht", curDir,node.Name);
            this.webBrowser1.Url = new Uri(urle);
        }

        private void frmHelp_Load(object sender, EventArgs e)
        {
            is_loaded = true;
            // add this form to window list
            ((Forms.FormMDI)this.MdiParent).addFormToWindowsList(this);
        }

        private void frmHelp_Activated(object sender, EventArgs e)
        {
            // activate this form and add it windows list as activate one
            ((Forms.FormMDI)fo).activateWindow(this);

        }

        private void frmHelp_FormClosed(object sender, FormClosedEventArgs e)
        {
            is_loaded = false;
            // remove this form from windows list
            ((Forms.FormMDI)fo).removeFormFromWindowsList(this);
        }
    }
}
